<!DOCTYPE html>
<html>
<head>
<title>Weiran ECMAScript Applications Framework</title>
<link rel=stylesheet type=text/css href=./style.css>
</head>

<body>

<div class=leftbar>
    <h1>Weiran</h1>
    <p>ECMAScript<br />Applications Framework</p>
    <p>Version: 1.2</p>
    <ul>
	<li><a href=Weiran.html>Weiran</a></li>
	<li><a href=Weiran.Array.html>Weiran.Array</a></li>
	<li><a href=Weiran.Buffer.html>Weiran.Buffer</a></li>
	<li><a href=Weiran.Class.html>Weiran.Class</a></li>
	<li><a href=Weiran.Date.html>Weiran.Date</a></li>
	<li>Weiran.DB<ul>
	    <li><a href=#Weiran.DB.set>Weiran.DB.set</a></li>
	    <li><a href=#Weiran.DB.get>Weiran.DB.get</a></li>
	    <li><a href=#Weiran.DB.deleteKey>Weiran.DB.deleteKey</a></li>
	    <li><a href=#Weiran.DB.flush>Weiran.DB.flush</a></li>
	    <li><a href=#Weiran.DB.storageObj>Weiran.DB.storageObj</a></li>
	    <li><a href=#Weiran.DB.storageSize>Weiran.DB.storageSize</a></li>
	    <li><a href=#Weiran.DB.storageAvailable>Weiran.DB.storageAvailable</a></li>
	    <li><a href=#Weiran.DB.index>Weiran.DB.index</a></li>
	    <li><a href=#Weiran.DB.reInit>Weiran.DB.reInit</a></li>
	</ul></li>
	<li><a href=Weiran.Event.html>Weiran.Event</a></li>
	<li><a href=Weiran.Events.html>Weiran.Events</a></li>
	<li><a href=Weiran.Function.html>Weiran.Function</a></li>
	<li><a href=Weiran.JSON.html>Weiran.JSON</a></li>
	<li><a href=Weiran.Lang.html>Weiran.Lang</a></li>
	<li><a href=Weiran.Number.html>Weiran.Number</a></li>
	<li><a href=Weiran.String.html>Weiran.String</a></li>
	<li><a href=Weiran.GRUB.html>GRUB Mechanism</a></li>
    </ul>
    <p>
        Copyright &copy; All<span>i</span>dylls<br />
        2011 - 2012
    </p>
</div>

<div class=content>

<div class=reftitle>Weiran.DB</div>
<p>Sub namespace contains convenience functions for local storage manipulation.</p>

<a name=Weiran.DB.set></a>
<h3><code>Weiran.DB.set(key, value)</code></h3>
<p><b>Static method</b></p>
<p>
    <b>Parameters:</b><br />
    <span class=parameters>key</span> - <code>string</code><br />
    <span class=parameters>value</span> - any JSON-able value, including objects and arrays
</p>
<p><b>Returns: </b><code>object</code></p>
<p>Saves a value</p>

<a name=Weiran.DB.get></a>
<h3><code>Weiran.DB.get(key, default)</code></h3>
<p><b>Static method</b></p>
<p>
    <b>Parameters:</b><br />
    <span class=parameters>key</span> - <code>string</code><br />
    <span class=parameters>default</span> - optional default value if key doesn't exist
</p>
<p><b>Returns: </b><code>object</code></p>
<p>Retrieves value if key exists, or default if it doesn't.</p>

<a name=Weiran.DB.deleteKey></a>
<h3><code>Weiran.DB.deleteKey(key)</code></h3>
<p><b>Static method</b></p>
<p>
    <b>Parameters:</b><br />
    <span class=parameters>key</span> - <code>string</code>
</p>
<p><b>Returns: </b><code>boolean</code></p>
<p>Removes a key from the storage.</p>

<a name=Weiran.DB.flush></a>
<h3><code>Weiran.DB.flush()</code></h3>
<p><b>Static method</b></p>
<p>
    <b>Parameters:</b>
</p>
<p><b>Returns: </b><code>boolean</code></p>
<p>Clears the cache.</p>

<a name=Weiran.DB.storageObj></a>
<h3><code>Weiran.DB.storageObj()</code></h3>
<p><b>Static method</b></p>
<p>
    <b>Parameters:</b>
</p>
<p><b>Returns: </b><code>object</code></p>
<p>Returns a read-ony copy of the actual storage.</p>

<a name=Weiran.DB.storageSize></a>
<h3><code>Weiran.DB.storageSize()</code></h3>
<p><b>Static method</b></p>
<p>
    <b>Parameters:</b>
</p>
<p><b>Returns: </b><code>number</code></p>
<p>Returns the size of the storage in bytes.</p>

<a name=Weiran.DB.storageAvailable></a>
<h3><code>Weiran.DB.storageAvailable()</code></h3>
<p><b>Static method</b></p>
<p>
    <b>Parameters:</b>
</p>
<p><b>Returns: </b><code>boolean</code></p>
<p>Returns true if storage is available.</p>

<a name=Weiran.DB.index></a>
<h3><code>Weiran.DB.index()</code></h3>
<p><b>Static method</b></p>
<p>
    <b>Parameters:</b>
</p>
<p><b>Returns: </b><code>array</code></p>
<p>Returns the used keys as an array.</p>

<a name=Weiran.DB.reInit></a>
<h3><code>Weiran.DB.reInit()</code></h3>
<p><b>Static method</b></p>
<p>
    <b>Parameters:</b>
</p>
<p><b>Returns: </b><code>undefined</code></p>
<p>Reloads the data from browser storage.</p>

</div>

</body>
</html>
